package 线程.终止线程.Test02;

public class MyRunnable3 implements Runnable {
    boolean run = true;
    @Override
    public void run() {
        for (int i = 0; i < 10; i++){
            if (run){
                System.out.println(Thread.currentThread().getName() + "---->" + i);
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }else{
                return;
            }

        }
    }
}
